//
//  CycBLEMessageCenter.h
//  Cycling
//
//  Created by cjg.mini on 2023/3/10.
//

#import <Foundation/Foundation.h>
#import "CycBLEManager.h"
#import "CycBleMessage.h"

extern NSString * _Nonnull const CycBLEMessageCenterErrorDomain;

typedef void(^CycBLEMessageCenterCompletionBlock)(NSError * _Nullable error, NSData * _Nullable responseData);

NS_ASSUME_NONNULL_BEGIN

@interface CycBLEMessageCenter : NSObject

+ (CycBLEMessageCenter *)sharedInstance;

/// 发送数据
- (void)sendMessage:(CycBleMessage *)message withTimeOut:(CGFloat)timeOut completion:(CycBLEMessageCenterCompletionBlock)completion;

/// 添加消息回调block
- (void)addCompletionBlock:(CycBLEMessageCenterCompletionBlock)block forKey:(NSString *)key;
/// 移除消息回调block
- (void)removeCompletionBlockForKey:(NSString *)key;
/// 清除消息
- (void)clearMessages;

@end

NS_ASSUME_NONNULL_END
